<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<style>
	.fl-left{float:left;}
	.fl-right{float:right;}
	.cl{clear:both; }
	.mrg-left-5{margin-left:5px;}
	.mrg-left-10{margin-left:10px;}
	.btn{width:80px;height:45px;border-radius:5px;background:red;color:white;border:none;cursor:pointer;}
	.btn:hover {font-size:15px;}
	
	.context{width:800px;height:600px;border:1px solid black;margin-top:0px;margin-left:250px;}
	
	
	.address{width:600px;margin-left:100px;}
	.ads-info{border-bottom:1px solid black;margin:10px 0px;}
	.ads-phone{border-bottom:1px solid black;margin:10px 0px;}
	.ads-reve{border-bottom:1px solid black;margin:10px 0px;}
	
	.product{width:600px;margin-left:100px;height:50px;line-height:87px;}
	.pro-name{width:100px;}
	.pro-info{width:200px;}
	.pro-img{width:50px;height:50px;overflow:hidden;}
	.pro-price{width:100px;}
	.pro-number{width:50px;}
</style>
</head>
<body>
	<div class="context">
		<form action="" id="formsub">
			<!-- 地址 -->
			<h3>商品信息:</h3>
			<div class="address">
				<input type="hidden" name="proId" id="proId" value="" />
				<div class="ads-info" id="ads-info">
					商品名称：<input type="text" name="proName" id="proName"  />
				</div>
				<div class="ads-phone" id="ads-phone">
					商品描述：<input type="text" name="proDesc" id="proDesc" />
				</div>
				<div class="ads-reve" id="ads-reve">
					商品价格：<input type="text" name="price" id="price" value="" />
				</div>
				<div class="ads-reve" id="ads-reve">
					商品数量：<input type="text" name="stock" id="stock" value="" />
				</div>
				<input type="button" id="sub" class="btn fl-right" value="去购买" />
			</div>
			<div class="cl"></div>
		</form>
	</div>
	<script>
		var buyUrl = '';
		$(function(){
			$.ajax({
				url:'pro/getHot',
				data:{},
				dataType:'json',
				success:function(data){
					if('0000'==data.respCode){
						$('#proId').val(data.returnObj.id);
						$('#proName').val(data.returnObj.proName);
						$('#proDesc').val(data.returnObj.proDesc);
						$('#price').val(data.returnObj.price);
						$('#stock').val(data.returnObj.stock);
						buyUrl = data.returnStr+"?proId="+data.returnObj.id;
					}else{
						alert('加载失败');
					}
				 },
	            error:function () {
	            	alert('操作失败');
	            }
			})
		})
		$('#sub').on('click',function(){
			if(undefined==buyUrl||''==buyUrl){
				alert('加载失败');
				return false;
			}
			window.location.href=buyUrl;
		})
	</script>
</body>
</html>